return Class ({
	_name = "QuadButton",
	init = function (self, x, y, w, h, scale, label, quad, image, cb, rw, rh)
		self.x, self.y, self.w, self.h = x, y, w*scale, h*scale
		self.label, self.quad, self.image, self.callback = label, quad, image, cb
		self.scale = scale
		local font = _lg.getFont()
		local count = Game:get_actor(self.label)[2]
		local s = string.format("%s: %i", self.label, count)
		local fw = font:getWidth(label) * self.scale/4
		self.rw, self.rh = rw or self.w + fw, rh or self.h
		self.selected = false
	end,
	
	is_hovered = function (self)
		local mx, my = _lm.getPosition()
		return mx >= self.x and mx <= self.x + self.rw and
					 my >= self.y and my <= self.y + self.rh
	end,
	
	is_clicked = function (self)
		return (self:is_hovered () and _lm.isDown(1))
	end,
	
	update = function (self)
		if self:is_hovered () then 
			Game.cursor.show = nil
			Game.cursor.is_hovering = self
		end
		if self:is_clicked () then 
			self:callback()
		end
	end,
	
	draw = function (self)
				local count = Game:get_actor(self.label)[2]
		local s = string.format("%s: %i", self.label, count)
			_lg.setColor(.3, .3, .3)
		_lg.rectangle("fill", self.x, self.y, self.rw, self.rh)
		_lg.setColor(1, 1, 1)
		_lg.draw(self.image, self.quad, self.x, self.y, 0, self.scale, self.scale)
		_lg.print(s, self.x + self.w+1, self.y, 0, self.scale/4, self.scale/4)
		if self:is_hovered () or self.selected then
			_lg.setColor(1, 1, 1)
			_lg.rectangle("line", self.x, self.y, self.rw, self.rh)
		end
	end,
	
})
